<div id="registration">
	<?php echo $this->Form->create('Hoso', array('action' => 'dangkyonline','type' => 'file','inputDefaults' => array(
        'error' => false
    ))); ?>
	<div id="generalInfo">
		<p>
			<span class="title">Thủ tục hành chính:</span>
			<span><?php echo
				$this->Form->input('tthc_id',array(
                                      'type' => 'select',
                                      'options' => $tthcs,
                                      'selected' => $tthcId,
                                      'id' => 'tthc',
                                      'div' => false,
                                      'label' => false,
                                      'style' => 'width: 828px;'
                                  ));
				?>
			</span>
		</p>
		<p>
			<span class="title">Họ tên<span class="required">*</span></span>
			<span><?php echo $this->Form->input('hovaten', array('div' => false, 'label' => false));?></span>
			<span class="title2">Email<span class="required">*</span></span>
			<span><?php echo $this->Form->input('email', array('div' => false, 'label' => false));?></span>
		</p>
		<p>
			<span class="title">Số CMND<span class="required">*</span></span>
			<span><?php echo $this->Form->input('so_cmt', array('div' => false, 'label' => false));?></span>
			<span class="title2">Ngày Cấp<span class="required">*</span></span>
			<span><?php echo $this->Form->input('ngaycap', array('div' => false, 'label' => false, 'readonly' => true));?></span>
			<span class="title2">Nơi Cấp</span>
			<span><?php echo
				$this->Form->input('noi_cap',array(
                                      'type' => 'select',
                                      'options' => $thanhPhos,
                                      'selected' => '27',
                                      'div' => false,
                                      'label' => false
                                  ));
				?></span>
		</p>
		<p>
			<span class="title">Số điện thoại<span class="required">*</span></span>
			<span><?php echo $this->Form->input('mobile', array('div' => false, 'label' => false));?></span>
			<span class="title2">Địa chỉ</span>
			<span><?php echo $this->Form->input('dia_chi', array('div' => false, 'label' => false, 'style' =>'width: 429px;'));?></span>
		</p>
	</div>
	<div id="thanhphan">
		<table width="100%" cellspacing="0">
			<tr>
				<td style="width: 50px;">STT</td>
				<td>Thành phần hồ sơ</td>
				<td style="width: 100px;">Upload bản scan</td>
			</tr>
			<?php foreach ($thanhphans as $key => $thanhPhan):?>
				<tr>
					<td align="center"><?php echo $key + 1;?></td>
					<td><?php echo $thanhPhan['ThanhPhan']['ten'];?></td>
					<td align="center">
						<?php 
						if ($thanhPhan['ThanhPhan']['type'] == 1) 
							echo $this->Form->input('file_'.$thanhPhan['ThanhPhan']['id'], array('label' => false,'type' => 'file'));
						else						
							echo 'Điền form trực tiếp';
						?>
					</td>
				</tr>
			<?php endforeach; ?>
		</table>
		<div style="margin-top: 20px;">
			<div class="fl">
				<span style="height: 23px;">Số bộ hồ sơ</span>
				<span style="margin-left: 10px; display: inline-block; width: 80px; background: #FFF; line-height: 23px; text-align: right; padding-right: 5px;"><?php echo $selectedTthc['Tthc']['sobohoso'];?></span>
			</div>
			<div class="fr">
				<span style="height: 23px;">Phí dịch vụ: </span>
				<span style="margin-left: 10px; display: inline-block; width: 80px; background: #FFF; line-height: 23px; text-align: right; padding-right: 5px;"><?php echo number_format($selectedTthc['Tthc']['le_phi']);?></span> đồng
			</div>
			<div class="clear"></div>
		</div>
	</div>
	<div id="buttons">
		<button class="button" id="cancel">Hủy</button>
		<button class="button" id="next">Đăng ký</button>
		<div class="clear"></div>
	</div>
	<?php echo $this->Form->end();?>
</div>
<script type="text/javascript">
	var form = $("#registration form");
	function ready() {
		$("#next").click(function(){
			form.submit();
		});
		$("#cancel").click(function(){
			form.attr('action',"<?php echo FULL_BASE_URL.'/'.(!empty($app)?$app.'/':'').$selectedMenu;?>");
			form.submit();
		});
		
		$("#HosoNgaycap").datepicker({dateFormat: 'dd/mm/yy',changeYear: true});
		
		$("#tthc").change(function (){
			window.location.href = '<?php echo FULL_BASE_URL.'/'.(!empty($app)?$app.'/':'').$selectedMenu;?>/dangkyonline/'+this.value;
		});
	};
	$(document).ready(function () {ready();});
</script>